{% extends "index.html" %}
{% load static %}
{% load jsonify %}

{% block page_content %}
<script src='{% static "js/exfun.js" %}'></script>
<script src='{% static "js/fields.pack.js" %}'></script>
<script src='{% static "js/table.pack.js" %}'></script>
<script type="text/javascript">
	infos = {{ infos | jsonify }}
	rows = {{ rows | jsonify}}
	$(function () {
		new Vue({
			el:'#there',
			data:{
		        infos:infos,
		        rows:rows,
			},
			methods:{
				map:function (name,row) {
					if(name==heads[0].name){
			                return '<a href="edit/'+row.pk+'">'+row[name]+'</a>'
		                }else{
			                return row[name]
			        }
				},
				del_rows:function () {
					var self =this
					var post_data=[{fun:'del_rows',rows:this.rows}]
					$.post('/_ajax',JSON.stringify(post_data),function (data) {
						if(data.del_rows){
							//if(window.opener.on_subwin_close){
							//	window.opener.on_subwin_close(data.del_rows.rows)
							//}
							self.next_page()
						}
					})
				},
				next_page:function () {
					var search = ex.parseSearch()
					if(search._pop){
						window.close()
					}
					var next = search.next
					if(next){
						var url = 
						location=url
					}
					
				}
			}
			
		})
	})
</script>

	<div id='there'>
		<h1>就要删除的记录是：</h1>
		<div v-for='(info,key) in infos'>
			<h3 v-text='key'></h3>
			<ul>
				<li v-for='item in info'>
					<span v-text='item.str'></span>
				</li>
			</ul>
		</div>
		<button name="test" type="button" @click='del_rows()'>确定删除</button>
		<button name="test" type="button" @click='next_page()'>取消</button>
	</div>
	
</div>
<style type="text/css" media="screen" id="test">
	.btn-group{
		display: inline-block;
		margin: 3px 10px;
		padding: 5px 5px;
		background-color: #F2F2F2;
		border: 1px solid #D4D4D4;
		border-radius:3px;
	}
</style>

{% endblock %}